var Keep = {
	insertKeep:function(req, uName, type, kID, callback){
		switch(type){
			case 'video':{
				req.users.update(
					{'name':uName},{
						$addToSet:{
							'keepAV':req.dbid(kID)
						}
					},function(err, result){
						callback('ok')
					}
				)
				break;
			}
			case 'article':{
				req.users.update(
					{'name':uName},{
						$addToSet:{
							'keepAT':req.dbid(kID)
						}
					},function(err, result){
						callback('ok')
					}
				)
				break;
			}
		}
			
	},
	findKeep:function(req, uID, callback){
		req.users.findById(uID, function(err, result){
			if (err) {
				callback('bad request')
			} else {
				callback(result)
			}
		})
	},
	removeKeep:function(req,uName,type,kID,callback){
		switch(type){
			case 'video':{
				req.users.update(
					{'name':uName},{
						$pull:{
							'keepAV':req.dbid(kID)
						}
					},function(err, result){
						callback('ok')
					}
				)
				break;
			}
			case 'article':{
				req.users.update(
					{'name':uName},{
						$pull:{
							'keepAT':req.dbid(kID)
						}
					},function(err, result){
						callback('ok')
					}
				)
				break;
			}
		}
	},
}
module.exports = Keep;